<div th:fragment="formHTML">
	<div class="layui-form-item" th:each="row : ${dto.rows}">
		<div class="layui-inline layui-col-xs4 margin_r0" th:each="form : ${row.formArr}" th:if="${form.type != 't_textarea'}">
			<!-- 文本框 -->
			<div th:if="${form.type == 't_text'}">
				<label class="layui-form-label"><font class="f_red" th:if="${form.required == 1}">*</font>[[${form.name}]]：</label>
				<div class="layui-input-block">
					<input type="text" th:name="${form.code}" th:value="${form.value}" autocomplete="off" th:placeholder="${form.name}" class="layui-input cannot-edit" th:lay-verify="${form.required == 1} ? 'required' : ''" th:readonly="${form.stateReadonly == 1} ? 'true' : 'false'">
				</div>
			</div>
			<!-- 普通选择框 -->
			<div th:if="${form.type == 't_dropdown'}">
				<label class="layui-form-label"><font class="f_red" th:if="${form.required == 1}">*</font>[[${form.name}]]：</label>
				<div class="layui-input-block">
					<select th:name="${form.code}" lay-verify="">
						<option value="">请选择[[${form.name}]]</option>
						<option th:each="option : ${form.optionArr}" th:value="${option.value}" th:selected="${option.selected}">[[${option.name}]]</option>
					</select>
				</div>
			</div>
			<!-- 单选框radio -->
			<div th:if="${form.type == 't_radio'}">
				<label class="layui-form-label"><font class="f_red" th:if="${form.required == 1}">*</font>[[${form.name}]]：</label>
				<div class="layui-input-block">
					<input type="radio" th:name="${form.code}" th:each="option : ${form.optionArr}" th:value="${option.value}" th:title="${option.name}" lay-skin="primary" lay-filter="type" th:checked="${option.selected}">
				</div>
			</div>
			<!-- 弹出框(单选) -->
			<div th:if="${form.type == 't_buttontext'}">
				<label class="layui-form-label"><font class="f_red" th:if="${form.required == 1}">*</font>[[${form.name}]]：</label>
				<div class="layui-input-block margin_l_90" style="display: flex;">
					<input th:data-id-field-value="${form.id}" type="hidden" th:name="${form.code}" th:value="${form.value}">
					<input th:data-id-field-name="${form.id}" type="text" autocomplete="off" class="layui-input" th:value="${form.value}" style="border: solid 0.1px; border-color: #B5B5B5; width:90%;" readonly="readonly">
					<i class="layui-icon layui-icon-close-fill" style="height: 30px; line-height: 30px;" title="清空此条件" onclick="this.previousSibling.previousSibling.value = '';this.previousSibling.previousSibling.previousSibling.previousSibling.value = '';"></i>
					<i style="position: relative; right: 40px; height: 30px; line-height: 30px;" class="layui-icon layui-icon-more" th:onclick="showModal('[(${form.id})]')"></i>
				</div>
			</div>
			<!-- 图片 -->
			<div th:if="${form.type == 't_file2'}">
				<label class="layui-form-label"><font class="f_red" th:if="${form.required == 1}">*</font>[[${form.name}]]：</label>
				<div class="layui-input-block">
					<input type="hidden" th:name="${form.code}" th:value="${form.value}">
					<img th:if="${form.value == null or form.value eq ''}" style="width: 92px;height: 92px;margin: 0 10px 10px 0;" th:label="${form.code}" src="/static/img/img_add.jpg" lay-filter="imgUpload">
					<img th:if="${form.value != null and form.value ne ''}" style="width: 92px;height: 92px;margin: 0 10px 10px 0;" th:label="${form.code}" th:src="${form.value}" lay-filter="imgUpload">
				</div>
			</div>
		</div>
		<div class="layui-inline layui-col-xs12 margin_r0" th:each="form : ${row.formArr}" th:if="${form.type == 't_textarea'}">
			<!-- 文本区域 -->
			<div th:if="${form.type == 't_textarea'}">
				<label class="layui-form-label"><font class="f_red" th:if="${form.required == 1}">*</font>[[${form.name}]]：</label>
				<div class="layui-input-block">
					<textarea th:name="${form.code}" th:text="${form.value}" th:lay-verify="${form.required == 1} ? 'required' : ''" th:placeholder="${form.name}" class="layui-textarea" th:classappend="${form.stateReadonly == 1} ? 'cannt-edit': ''" th:readonly="${form.stateReadonly == 1} ? 'true' : 'false'"></textarea>
				</div>
			</div>
		</div>
	</div>
</div>
<div th:fragment="formJS">
	<script type="text/javascript">
	$(function () {
		// 初始化上传控件
		$('img[lay-filter="imgUpload"]').each(function(index, domEle){
			var dom = this;
			var labelName = $(this).attr('label');
			layui.upload.render({
				elem: dom,
				url: 'https://file.mini-ease.com/api/outer/upload/uploadfileForLayer',
				multiple: false,
				progress: function(n, elem){
					//dom.val(n + '%');
				},
				done: function(res){
					if (res.code == 200) {
						$('img[label="' + labelName +'"]').attr('src', res.url);
						$('input[name="' + labelName +'"]').val(res.url);
					}
				}
			});
		})
	});
	
	function showModal(colId) {
    	var w=($(window).width()*0.9);
    	var h=($(window).height() - 50);
        layer.open({
            type: 2,
            area: [w+'px', h +'px'],
            fix: true,
            maxmin: false,
            shadeClose: true,
            shade:0.4,
            title: "选择",
            content: '/toModalSelector?colId=' + colId + '&type=3'
        });
	}
	</script>
</div>

<div th:fragment="footerHTML">
	<div class="layui-inline layui-col-xs3 margin_r0">
		<label class="layui-form-label">[[${dto.footer.createUser.nameShow}]]：</label>
		<div class="layui-input-block">
			<input type="hidden" th:name="${dto.footer.createUser.codeHidden}" th:value="${dto.footer.createUser.valueHidden}">
			<input type="text" th:value="${dto.footer.createUser.valueShow}" class="layui-input" readonly="true">
		</div>
	</div>
	<div class="layui-inline layui-col-xs3 margin_r0">
		<label class="layui-form-label">[[${dto.footer.createDept.nameShow}]]：</label>
		<div class="layui-input-block">
			<input type="hidden" th:name="${dto.footer.createDept.codeHidden}" th:value="${dto.footer.createDept.valueHidden}">
			<input type="text" th:value="${dto.footer.createDept.valueShow}" class="layui-input" readonly="true">
		</div>
	</div>
	<div class="layui-inline layui-col-xs3 margin_r0">
		<label class="layui-form-label">[[${dto.footer.createRole.nameShow}]]：</label>
		<div class="layui-input-block">
			<input type="hidden" th:name="${dto.footer.createRole.codeHidden}" th:value="${dto.footer.createRole.valueHidden}">
			<input type="text" th:value="${dto.footer.createRole.valueShow}" class="layui-input" readonly="true">
		</div>
	</div>
</div>